package com.learn.temp.api;

import sun.misc.Launcher;

import javax.sound.midi.Soundbank;
import java.net.URL;

/**
 * @author wangxing
 * @version 2020/6/10 23:48 Administrator
 */
public class TestJDKClassLoader {
    public static void main(String[] args) {
        System.out.println(String.class.getClassLoader());
        System.out.println(com.sun.crypto.provider.DESKeyFactory.class.getClassLoader().getClass().getName());
        System.out.println(TestJDKClassLoader.class.getClassLoader().getClass().getName());
        System.out.println("============================");
        ClassLoader appClassLoad = ClassLoader.getSystemClassLoader();
        ClassLoader extClassLoad = appClassLoad.getParent();
        ClassLoader bootStartLoader = extClassLoad.getParent();
        System.out.println("bootStartLoader:" + bootStartLoader);
        System.out.println("extClassLoad:" + extClassLoad);
        System.out.println("appClassLoad:" + appClassLoad);
        System.out.println("=====================");
        System.out.println("bootStartLoader 加载文件路径");
        URL[] urls = Launcher.getBootstrapClassPath().getURLs();
        for (URL url : urls) {
            System.out.println(url);
        }
        System.out.println("=====================");
        System.out.println("extClassLoad 加载文件路径");
        System.out.println(System.getProperty("java.ext.dirs"));
        System.out.println("=====================");
        System.out.println("appClassLoad 加载文件路径");
        System.out.println(System.getProperty("java.class.path"));

    }
}
